package org.jground.rx.ui.zk.viewControl;

import org.jground.rx.RXView;
import org.jground.rx.ui.IUIAttributeControl;
import org.jground.rx.ui.IUIAttributeView;
import org.jground.rx.ui.zk.UIFrame;
import org.jground.util.ArrayUtils;
import org.jground.zk.zulX.DivX;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Label;

public class UIViewControlDummy extends UIAttributeViewBase implements IUIAttributeControl<Component,UIFrame> {

    private String[] values;
    private DivX textDIV;

    public UIViewControlDummy() {
        super();
    }

    private UIViewControlDummy(UIFrame uiFrame, RXView moView) {
        super(uiFrame, moView);
        add(textDIV = new DivX());
    }

    public String[] Get() {
        return values;
    }

    public void set(String... values) {
        this.values = values;
        textDIV.set(new DivX(new Label("{dummy view}")));
        if (ArrayUtils.isNotEmpty(values)) {
            for (String s : values) {
                textDIV.add(new DivX(new Label(s)));
            }
        }
    }

    public void clear() {
        values = null;
        textDIV.removeAll();
    }

    public String[] get() {
        // TODO Auto-generated method stub
        return null;
    }

    public IUIAttributeView<Component,UIFrame> createNew(UIFrame uiFrame, RXView moControl) {
        return new UIViewControlDummy(uiFrame, moControl);
    }

}